/*
   \file  lazebnik_driver.cc
   \brief Test-drive the lazebnik algorithm.

   This file defines the static data members and non-inline member
   functions of the gistdrv::lazebnik_driver class. See the header file
   for more info.
*/

/*
   This file is part of libgist.

   libgist is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   libgist is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with libgist; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

/*
   REVISION HISTORY

   $HeadURL: http://libgist.googlecode.com/svn/branches/wu_dev/drv/lazebnik_driver.cc $
   $Id: lazebnik_driver.cc 53 2011-09-01 08:09:28Z libgist@gmail.com $
*/

//------------------------------ HEADERS --------------------------------

// gistdrv
#include "lazebnik_driver.hh"
#include "image.hh"
#include "config.hh"

//----------------------- NAMESPACE DEFINITION --------------------------

namespace gistdrv {

//------------------ STATIC DATA MEMBERS AND GLOBALS --------------------

// Factory setup
static const std::string ALGO_NAME("lazebnik") ;
lazebnik_driver::my_factory lazebnik_driver::register_me(ALGO_NAME) ;

//-------------------- INITIALIZATION AND CLEAN-UP ----------------------

lazebnik_driver:: lazebnik_driver(){}
lazebnik_driver::~lazebnik_driver(){}

//----------------------------- TRAINING --------------------------------

void
lazebnik_driver::
collect_training_data(const std::string& cat, const std::string& name)
{
   m_lazebnik.data(cat, image(name)) ;
}

void lazebnik_driver::train()
{
   m_lazebnik.train() ;
}

void lazebnik_driver::save_training_results()
{
   m_lazebnik.
      save_vocabulary(config::get<std::string>(ALGO_NAME, "vocabulary")) ;
   m_lazebnik.
      save_classifier(config::get<std::string>(ALGO_NAME, "classifier")) ;
}

//-----------------------------------------------------------------------

} // end of namespace encapsulating this file's definitions

/* So things look consistent in everyone's emacs... */
/* Local Variables: */
/* indent-tabs-mode: nil */
/* End: */
